using System;
using System.Drawing;

using Motorway_Simulator.GUI;
using Motorway_Simulator.GUI.Designer;



namespace Motorway_Simulator.Components
{
    /// <summary>
    /// Car vehicle
    /// </summary>
    [Serializable]
    public class Car : Vehicle
    {
        /// <summary>
        /// Holds the length
        /// </summary>
        private const int length = 30;

        /// <summary>
        /// Holds the vehicle image
        /// </summary>
        private Bitmap image = Motorway_Simulator.Properties.Resources.Car;

        /// <summary>
        /// Holds the width
        /// </summary>
        private const int width = 20;


        /// <summary>
        /// Initializes a new instance of the <see cref="Car"/> class.
        /// </summary>
        /// <param name="startPoint">Start point</param>
        /// <param name="currentRoadUnit">The current road unit.</param>
        public Car(Point startPoint,RoadUnit currentRoadUnit)
            : base(startPoint, length , currentRoadUnit)
        {
            this.maxAcclerationRate = 5;
            this.imageHeight = width;
            this.imageWidth = length;
            image = RotateImageClockWise(image); 
            
           
        }

        /// <summary>
        /// Draws the Vehicle on the given Graphis g.
        /// </summary>
        /// <param name="g">The g.</param>
        public override void Draw(Graphics g)
        {
            Console.WriteLine(" drawing image " + this.CurrentPoint.X + " " + (this.CurrentPoint.Y + (DesignCanvas.squareUnit / 2) - (length / 2f)));
            g.DrawImage(image, this.CurrentPoint.X,this.CurrentPoint.Y+(DesignCanvas.squareUnit/2)-(image.Height/2f));
            if (CurrentPoint != null)
            {

                g.DrawImage(image, this.CurrentPoint.X, this.CurrentPoint.Y + (DesignCanvas.squareUnit / 2) - (length / 2f), imageWidth, imageHeight);
            }
        }

    }
}